package com.ti.shangou.service.impl;

import com.ti.shangou.dao.ApprovalLogDao;
import com.ti.shangou.pojo.dto.PageDTO;
import com.ti.shangou.pojo.dto.ResponseDTO;
import com.ti.shangou.pojo.entity.ApprovalLog;
import com.ti.shangou.pojo.query.ApprovalLogQuery;
import com.ti.shangou.pojo.vo.ApprovalLogVO;
import com.ti.shangou.service.ApprovalLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 作者：田宝山
 * 日期：2020/6/5
 */
@Service
public class ApprovalLogServiceImpl implements ApprovalLogService {
    @Resource
    ApprovalLogDao approvalLogDao;

    public PageDTO getMerchantLogsByQuery(ApprovalLogQuery query) {
        List<ApprovalLogVO> approvalLogVOList =  approvalLogDao.selectMerchantLogsByQuery(query);
        Integer count = approvalLogDao.selectMerchantLogsCount(query);
        return PageDTO.setPageData(count,approvalLogVOList);
    }

    public ResponseDTO addApproval(ApprovalLog approvalLog){
        return ResponseDTO.get(approvalLogDao.insertSelective(approvalLog)==1);
    }
}
